Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow momentum coords in to_Vector*D methods + cleanup #423

Merged

Conversation

Saransh-cpp
Copy link
Member

Description

Fixes #382

Paves the way for #422 (make the conversions more user-friendly)

cc: @nsmith-, @iasonkrom, @lgray

Checklist

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't any other open Pull Requests for the required change?
  • Does your submission pass pre-commit? ($ pre-commit run --all-files or $ nox -s lint)
  • Does your submission pass tests? ($ pytest or $ nox -s tests)
  • Does the documentation build with your changes? ($ cd docs; make clean; make html or $ nox -s docs)
  • Does your submission pass the doctests? ($ pytest --doctest-plus src/vector/ or $ nox -s doctests)

Before Merging

  • Summarize the commit messages into a brief review of the Pull request.

Copy link

codecov bot commented Feb 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.92%. Comparing base (e4c3f53) to head (b12df12).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #423      +/-   ##
==========================================
+ Coverage   82.87%   82.92%   +0.05%     
==========================================
  Files          96       96              
  Lines       11533    11533              
==========================================
+ Hits         9558     9564       +6     
+ Misses       1975     1969       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Saransh-cpp Saransh-cpp force-pushed the momentum-coords-in-conversion branch from 6e7b8df to b12df12 Compare February 28, 2024 13:00
Copy link
Member

@jpivarski jpivarski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember the discussion on this and I must have missed the review request.

It's a good extension, though I'm worried about the possibility that a user would pass both z and pz to one of these functions (see below).

Comment on lines 3216 to +3227
z: float | None = None,
pz: float | None = None,
theta: float | None = None,
eta: float | None = None,
t: float | None = None,
e: float | None = None,
E: float | None = None,
energy: float | None = None,
tau: float | None = None,
m: float | None = None,
M: float | None = None,
mass: float | None = None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If somebody passes both z and pz, or both z and theta for that matter, does the function complain? It shouldn't just pick one and use it—providing (possibly) conflicting arguments should be an error, to prevent silent mistakes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review! Yes, the functions was checking for multiple generic coordinates, and I've added momentum coordinated to that check too.

@Saransh-cpp Saransh-cpp merged commit 6574993 into scikit-hep:main Feb 29, 2024
21 checks passed
@Saransh-cpp Saransh-cpp deleted the momentum-coords-in-conversion branch February 29, 2024 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow momentum type coordinates in to_Vector*D methods
2 participants